package com.yic.module.mes.dal.mysql.itemproducerouteextend;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.mes.dal.dataobject.itemproducerouteextend.ItemProduceRouteExtendDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.mes.controller.admin.itemproducerouteextend.vo.*;

/**
 * 产品工艺路线配置 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface ItemProduceRouteExtendMapper extends BaseMapperX<ItemProduceRouteExtendDO> {

    default PageResult<ItemProduceRouteExtendDO> selectPage(ItemProduceRouteExtendPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ItemProduceRouteExtendDO>()
                .betweenIfPresent(ItemProduceRouteExtendDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ItemProduceRouteExtendDO::getId));
    }

    default List<ItemProduceRouteExtendDO> selectList(ItemProduceRouteExtendExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ItemProduceRouteExtendDO>()
                .betweenIfPresent(ItemProduceRouteExtendDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ItemProduceRouteExtendDO::getId));
    }

    default int deleteByItemProduceId(Long itemProduceId) {
        return delete(new LambdaQueryWrapperX<ItemProduceRouteExtendDO>()
                .eq(ItemProduceRouteExtendDO::getItemProduceId, itemProduceId));
    }

    default List<ItemProduceRouteExtendDO> selectListByItemProduceId(Long itemProduceId) {
        return selectList(new LambdaQueryWrapperX<ItemProduceRouteExtendDO>()
                .eq(ItemProduceRouteExtendDO::getItemProduceId, itemProduceId));
    }

    default List<ItemProduceRouteExtendDO> selectListByItemProduceId(Collection<Long> itemProduceIds) {
        return selectList(new LambdaQueryWrapperX<ItemProduceRouteExtendDO>()
                .in(ItemProduceRouteExtendDO::getItemProduceId, itemProduceIds));
    }
}
